//
//  TitleButton.swift
//  MyWeiboApp
//
//  Created by 胡海波 on 15/6/30.
//  Copyright © 2015年 胡海波. All rights reserved.
//

import UIKit

class TitleButton: UIButton {


    class func button(title: String) -> TitleButton {

        let btn = TitleButton()
        btn.setTitle(title + " ", forState: UIControlState.Normal)
        btn.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(17)
        btn.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        btn.sizeToFit()

        return btn

    }
    override func layoutSubviews() {

        super.layoutSubviews()

        titleLabel?.frame.origin.x = 0

        imageView?.frame.origin.x = titleLabel!.bounds.width
    }

}
